define(function(require, exports, module) {
    var router = require("router");
    //var app = require("app");
    var controller = {};
    controller.vue = function() {
        controller.vm = new Vue({
            router: router,
            data: function() {
                return {
                    pid:0,
                    from:'wx',
                    showType:1,
                    weui_icon:'',
                    weui_msg_title:'',
                    weui_msg_desc:'',

                };
            },
            el: '#pageIndex',
            created: function() {
                this.fetchData();
            },
            methods: {
                fetchData: function() {
                    var _this = this;
                    this.from=this.$route.params.from;
                    var user_info = app.getUserInfo();
                    if(this.from=='app'){
                        this.showType=3;
                        app.get("apiv2/mch/mch_info_search", {
                            store_id:281//user_info.store_id
                        }, function (res) {
                          if (res.code == 200) {
                             _this.merchant = res.data;
                             _this.showType=2;
                             if( _this.merchant.status<1){
                                _this.weui_icon ='weui_icon_waiting weui_icon_msg';
                                _this.weui_msg_title = "申请已提交，审核中...";
                                _this.weui_msg_desc = "我们将在一个工作日完成审核。";
                             }
                             if( _this.merchant.status==1){
                                _this.weui_icon ='weui_icon_success weui_icon_msg';
                                _this.weui_msg_title = "通过审核";
                                _this.weui_msg_desc = "资料已通审核，可正常使用收款功能。";
                             }
                             if( _this.merchant.status==2){
                                _this.weui_icon ='weui_icon_warn weui_icon_msg';
                                _this.weui_msg_title = "审核不通";
                                _this.weui_msg_desc = "原因："+ _this.merchant.statusInfo.examineStatusRemark +"。";
                             }

                             
                          }else{
                             _this.showType=1;
                          }
                          
                        });
                    }
                },
                reapply:function(){
                this.showType=1;
              }
 
            }

        }).$mount('#app');
    };
    module.exports = controller;
});
